package com.neusoft.elmboot.mapper;

import com.neusoft.elmboot.po.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {

    @Select("select * from user where userId=#{userId} and password=#{password}")
    public User getUserByIdByPass(User user);

    @Select("select * from user where userId=#{userId}")
    public User getUserById(String userId);

    @Insert("insert into user values(#{userId},#{password},#{userName},#{userSex},#{userImg},1)")
    public int saveUser(User user);

    public int updateUserById(User user);

    @Delete("delete from user where userId=#{userId}")
    public int removeUser(User user);

    @Delete("delete from orders where userId=#{userId}")
    public int removeOrders(User user);

    @Delete("delete from cart where userId=#{userId}")
    public int removeCart(User user);

    @Delete("delete from comments where userId=#{userId}")
    public int removeComments(User user);

    @Delete("delete from deliveryaddress where userId=#{userId}")
    public int removeDeliveryaddress(User user);

    @Delete("delete from integraltrans where userId=#{userId}")
    public int removeIntegraltrans(User user);

    @Delete("delete from integrationlog where userId=#{userId}")
    public int removeIntegrationlog(User user);

    @Delete("delete from wallet where userId=#{userId}")
    public int removeWallet(User user);

}
